load("@aspect_rules_js//js:defs.bzl", "js_binary")
load("//tools:defaults.bzl", "jasmine_test", "ts_project")

package(default_visibility = ["//visibility:public"])

ts_project(
    name = "transform-markdown",
    srcs = glob(
        ["**/*.ts"],
        exclude = [
            "*.spec.ts",
        ],
    ),
    tsconfig = "//tools:tsconfig",
    deps = [
        "//:node_modules/marked",
        "//:node_modules/slugify",
        "//tools/highlight-files:sources",
    ],
)

js_binary(
    name = "markdown-to-html",
    data = [
        ":transform-markdown",
    ],
    entry_point = ":transform-markdown.js",
)

ts_project(
    name = "unit_test_lib",
    testonly = True,
    srcs = glob(
        ["*.spec.ts"],
    ),
    tsconfig = "//tools:tsconfig-test",
    visibility = ["//visibility:private"],
    deps = [
        ":transform-markdown",
        "//:node_modules/@types/jasmine",
        "//:node_modules/@types/node",
        "//:node_modules/marked",
        "//:node_modules/typescript",
    ],
)

jasmine_test(
    name = "unit_tests",
    data = [":unit_test_lib"],
)
